package com.itheima.consumer.listener;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @version 1.0
 * @Author lwx
 * @Date 2024/12/27 14:46
 */
@Component
public class TopicListener {

    @RabbitListener(queues = "topic.queue1")
    public void listener1(String msg) throws InterruptedException {

        System.out.println("消费者1号接收到消息。。。。。：" + msg+"||1||"+ LocalDateTime.now());
    }

    @RabbitListener(queues = "topic.queue2")
    public void listener2(String msg) throws InterruptedException {

        System.out.println("消费者2号接收到消息：" + msg+"||2||"+LocalDateTime.now());
    }

    @RabbitListener(queues = "topic.queue2")
    public void listener3(String msg) throws InterruptedException {

        System.out.println("消费者2号接收到消息：" + msg+"||2||"+LocalDateTime.now());
    }



}
